import {Component, ViewChild} from '@angular/core';
import {Nav, Platform} from 'ionic-angular';

import {CommonProvider} from "@providers/common";
import {SplashScreen} from "@ionic-native/splash-screen";
import {StatusBar} from "@ionic-native/status-bar";
import {UpdateProvider} from "@providers/update";
import {JlMessageProvider} from "@providers/jl-message";

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild('nav') nav: Nav;

  rootPage: any;

  constructor(private platform: Platform,
              private statusBar: StatusBar,
              private splashScreen: SplashScreen,
              private common: CommonProvider,
              private update: UpdateProvider,
              private jlMessage: JlMessageProvider) {

     this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      this.statusBar.styleDefault();

      this.splashScreen.hide();

      this.common.initialization();

      this.jlMessage.checkWebsocket();

      this.rootPage = common.getRootPage();

      this.update.timer();
      this.common.registerBackButtonAction();
    });

  }
}
